﻿<form action="<%= submitPath %>?_csrf=<%= locals.csrfToken %>"
      method="POST"
      enctype="multipart/form-data">
    <p>
        <label for="title">Title</label>
        <input type="text" id="title"
               value="<%= product.title %>"
               name="title" required>
    </p>

    <div class="image-upload-control">
        <p>
            <label for="image">Image</label>
            <input type="file" id="image"
                   name="image"
            <% if(imageRequired){ %> required
                    <% } %>
                   accept="image/png,image/jpg">
        </p>
        <img src="" alt="Selected image.">
    </div>


    <p>
        <label for="summary">Summary</label>
        <input type="text" id="summary"
               name="summary" required
               value="<%= product.summary %>"
               maxlength="250">
    </p>
    <p>
        <label for="price">Price</label>
        <input type="number" id="price"
               name="price" required
               value="<%= product.price %>"
               min="0.01" step="0.01">
    </p>
    <p>
        <label for="description">Description</label>
        <textarea id="description"
                  name="description" rows="7"
                  required>
            <%= product.description %>
        </textarea>
    </p>
    <p>
        <button type="reset"
                class="btn btn-alt">Reset
        </button>
        <button class="btn">Save</button>
    </p>
</form>